from calibration_nodes.Node import *

class Doppler(Node):
    def __init__(self):
        #每隔time_threshold秒就需要重新校准一次
        self.time_threshold = 10000
        pass

    def run(self):
        k = random.random()
        if k > 0.01:
            return (1, {None})
        else:
            return (-1,{None})

    def check(self, last_calibration_time = None):
        '''
        check函数主要用来检测当前这一结点是否过时
        '''
        if time.time() - last_calibration_time > self.time_threshold:
            return 0
        else:
            return 1
        #assert last_calibration_time != None
